#pragma once

#include "common/common.h"
#include "ipc/imutualexclusionlock.h"

#if defined(WINDOWS)

#else

#include <pthread.h>   
#include <unistd.h>  
#include <stdio.h>
#include <sys/shm.h>
#include <sys/time.h>
#include <time.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <semaphore.h>

#endif

namespace PILO 
{
    namespace Core
    {
        namespace IPC 
        {
            class CThreadMutex : public IMutualExclusionLock
            {
            public:
                CThreadMutex();
                ~CThreadMutex();
                BOOL tryLock() const;
                void lock() const;
                void unlock() const;

            protected:
#           ifdef WINDOWS
                mutable CRITICAL_SECTION _m_mutex;
#           else
                mutable pthread_mutex_t _m_mutex;
#           endif
            };

        }    
    }
}
